#ifdef __APPLE__
    #include <SDL/SDL.h>
    #include "SDL/SDL_opengl.h"
#else
    #include <SDL/SDL.h>
    #include "GL/gl.h"
    #include "GL/glu.h"
    #include "GL/glext.h"
#endif
#include "BM_init.h"

int BMInit::initGL(int swidth, int sheight)
{
    /* Enable Texture Mapping ( NEW ) */
    glEnable( GL_TEXTURE_2D );

    /* Enable smooth shading */
    glShadeModel( GL_SMOOTH );

    /* Set the background black */
    glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );

    /* Depth buffer setup */
    glClearDepth( 1.0f );

    /* Enables Depth Testing */
    glEnable( GL_DEPTH_TEST );

    /* The Type Of Depth Test To Do */
    glDepthFunc( GL_LEQUAL );

    /* Really Nice Perspective Calculations */
    glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );

    // resize the initial window
    GLfloat ratio;

    // Protect against a divide by zero
    ratio = ( GLfloat )swidth / ( GLfloat )sheight;

    // Setup our viewport.
    glViewport( 0, 0, ( GLint )swidth, ( GLint )sheight );

    // change to the projection matrix and set our viewing volume.
    glMatrixMode( GL_PROJECTION );
    glLoadIdentity( );

    // Set our perspective
    gluPerspective( 45.0f, ratio, 0.1f, 100.0f );

    // Make sure we're chaning the model view and not the projection
    glMatrixMode( GL_MODELVIEW );

    // Reset The View
    glLoadIdentity( );

    //If there was any errors
    if(glGetError() != GL_NO_ERROR)
        return 0;

    //If everything initialized
    return 1;
}

